package com.ruoyi.yljf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.BannerMapper;
import com.ruoyi.yljf.domain.Banner;
import com.ruoyi.yljf.service.IBannerService;

import javax.annotation.Resource;

/**
 * 轮播图Service业务层处理
 * 
 * @author metaee
 * @date 2025-04-28
 */
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements IBannerService {
    @Resource
    private BannerMapper bannerMapper;
    
    /**
     * 查询轮播图列表
     * 
     * @param banner 轮播图
     * @return 轮播图
     */
    @Override
    public List<Banner> selectBannerList(Banner banner) {
    	LambdaQueryWrapper<Banner> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotEmpty(banner.getUrl())) {
			queryWrapper.eq(Banner::getUrl, banner.getUrl());
		}
        if (StringUtils.isNotEmpty(banner.getSkipType())) {
			queryWrapper.eq(Banner::getSkipType, banner.getSkipType());
		}
        if (StringUtils.isNotNull(banner.getSkipId())) {
			queryWrapper.eq(Banner::getSkipId, banner.getSkipId());
		}
        if (StringUtils.isNotEmpty(banner.getType())) {
			queryWrapper.eq(Banner::getType, banner.getType());
		}
        return bannerMapper.selectList(queryWrapper);
    }
}
